<template>
	<view class="p2">
		<view class="flex" style="">
			<view class="  p2" style="background-color: #fff;width: 100%;">
				<scroll-view scroll-y="true" class="scroll-Y">
					<uni-card>
						<uni-table border stripe type="selection" :type="'2'" @selection-change="selectionData">
							<uni-tr>


						 <uni-th v-for="(vo,index) in th_list" :key="index" align="center">{{vo.name}}</uni-th>


							</uni-tr>
							<uni-tr v-for="(vo,index) in list" :key="index">
								
								
								<uni-td align="center" v-for="(item,index1) in th_list" >
									
									<text v-if="item.type=='text'">{{vo[item.field]}}</text>
									
									<template v-else>
										 <button v-if="vo[item.field]" @click="on_edit(vo.id,item.edit_val)"
										 	type="primary" size="mini">设置</button>
									</template>
								
								 
								</uni-td>

							</uni-tr>
						</uni-table>

					</uni-card>
				</scroll-view>
			</view>
		</view>
		<edit ref="component_edit" @confirm="confirm_edit">
		</edit>

	</view>
</template>

<script>
	import edit from './edit.vue';
	export default {
		components: {
			edit
		},
		data() {
			return {
				list: [],
				last_page: 0,
				total: 0,
				page: 1,
				name: '',
				keya: '',
				uid: '',
				tel: '',
	
				id: '',
				th_list: []
			}
		},
		onLoad() {
			this.init();
		},
		methods: {
			confirm_edit() {
				this.page = 1;
				this.init()
			},
			on_edit(id, type) {
				this.id = id;

				this.$refs.component_edit.init(this.id, type)
			},
			getPage(id) {
				this.page = id.current;
				this.init()
			},

			init() {
				var that = this;
				let requestParams = {
					page: this.page,
					status: this.status,
				};
				this.Http.post('banmichaoqiangbizhi/admin/Settingsnotice/index', requestParams).then(ret => {
					this.list = ret.data.list;
					this.th_list = ret.data.th_list;
				})
			},
		}
	}
</script>

<style>

</style>